package com.example.demo.controller;


import com.example.demo.model.result;
import com.example.demo.services.BuyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/buyUser")
public class BuyController {

    @Autowired
    private BuyService buyService;

    private Logger logger= LoggerFactory.getLogger(getClass());


    @GetMapping("/getId")
    public result getId(String id){
        logger.info("正在查询用户{}购买记录",id);
        return result.success(buyService.selectUserId(id));
    }




    @GetMapping("/getAll")
    public result getAll(){
        logger.info("管理员正在查看所有的订单信息");
        return result.success(buyService.selectAll());
    }

}
